\defmodule{SqrtMathFunction}

Represents a function computing
the square root of another function
$f(x)$.

\bigskip\hrule

\begin{code}
\begin{hide}
/*
 * Class:        SqrtMathFunction
 * Description:  function computing the square root of another function
 * Environment:  Java
 * Software:     SSJ 
 * Copyright (C) 2001  Pierre L'Ecuyer and Universite de Montreal
 * Organization: DIRO, Universite de Montreal
 * @author       Éric Buist
 * @since

 * SSJ is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License (GPL) as published by the
 * Free Software Foundation, either version 3 of the License, or
 * any later version.

 * SSJ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * A copy of the GNU General Public License is available at
   <a href="http://www.gnu.org/licenses">GPL licence site</a>.
 */
\end{hide}
package umontreal.iro.lecuyer.functions;\begin{hide}
\end{hide}

public class SqrtMathFunction implements MathFunction\begin{hide} {
   private MathFunction func;
\end{hide}

   public SqrtMathFunction (MathFunction func)\begin{hide} {
      super ();
      if (func == null)
         throw new NullPointerException();
      this.func = func;
   }\end{hide}
\end{code}
\begin{tabb}   Computes and returns the square
 root of the function \texttt{func}.
\end{tabb}
\begin{htmlonly}
   \param{func}{the function to compute square root for.}
\end{htmlonly}
\begin{code}

   public MathFunction getFunction()\begin{hide} {
      return func;
   }\end{hide}
\end{code}
\begin{tabb}   Returns the function associated with
 this object.
\end{tabb}
\begin{htmlonly}
   \return{the associated function.}
\end{htmlonly}
\begin{code}\begin{hide}

   public double evaluate (double x) {
      return Math.sqrt (func.evaluate (x));
   }
}\end{hide}
\end{code}
